import React, { Component } from 'react'
import { UdForm, validators } from '../../../../index'
import { message, InputNumber } from 'antd'

class Demo extends Component {

  render() {
    return (
      <UdForm
        items={[
          { id: 'name', label: '姓名', rules: [validators.required] },
          { id: 'email', label: '邮箱' },
          { id: 'website', label: '个人主页' },
          { id: 'height', label: '身高', render: <InputNumber /> },
        ]}
        onSubmit={this.submit}
        footer="提交"
      />
    )
  }

  private submit = (values) => {
    let json = JSON.stringify(values)
    message.success(json)
    console.log(values)
  }

}

export default Demo
